package com.wanxi.object;

import com.wanxi.util.Tool;

import java.io.*;

public class ObjectOutTest {
    public static void main(String[] args) {
        String path = "E:\\wanxi\\step-2\\java02-0921\\day21OtherIOStream\\src\\com\\wanxi\\object";
        String fileName = "aa.txt";

        try {
            ObjectOutput objectOutput = new ObjectOutputStream(Tool.getFileOutputStream(path, fileName));
            objectOutput.writeObject(new Student("张三1", 11));
            objectOutput.writeObject(new Student("张三2", 22));
            objectOutput.writeObject(new Student("张三3", 33));
            objectOutput.writeObject(new Student("张三4", 411));
            objectOutput.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
